unzip libfastcommon-1.0.7.zip
cd libfastcommon-1.0.7 \
./make.sh
./make.sh install

#install fastdfs
tar -zxvf FastDFS_v5.05.tar.gz
cd FastDFS
./make.sh
./make.sh install
cp conf/*.conf /etc/fdfs
cd /etc/fdfs/
rm -rf *.sample

mkdir -p /home/data/fastdfs/{storage,tracker}

#openresty 安装
yum -y install pcre-devel openssl-devel gcc curl
tar -zxvf openresty-1.13.6.2.tar.gz
cd openresty-1.13.6.2
./configure
make && make install

#GraphicsMagick 安装
yum -y install libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel libtool-ltdl libtool-ltdl-devel
tar -zxvf GraphicsMagick-1.3.29.tar.gz
cd GraphicsMagick-1.3.29
./configure --prefix=/usr/local/GraphicsMagick --with-quantum-depth=8 --enable-shared --enable-static
make
make install



tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
cp ./fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
touch /etc/fdfs/mime.types
cd openresty-1.13.6.2
./configure --prefix=/usr/local/openresty --add-module=../fastdfs-nginx-module/src
make
#报错
#root/fastdfs-nginx-module/src//common.c:21:25: fatal error: fdfs_define.h: No such file or directory
# 解决方案
# sudo cp /usr/lib64/libfdfsclient.so /usr/lib/
#配置/usr/local/src/fastdfs-nginx-module/src/目录下的config文件，把CORE_INCS和CORE_LIBS的所有路径都修改为/usr/include和/usr/lib：
make install

#将裁剪功能复制到nginx配置文件下
\cp -r lua /usr/local/openresty/nginx/conf/
\cp nginx.conf /usr/local/openresty/nginx/conf/
\cp fastdfs.conf /usr/local/openresty/nginx/conf/vhosts/


sed -i "s#\(port\).*#\1=23000#" /etc/fdfs/storage.conf
sed -i "s#\(group_name\).*#\1=group1#" /etc/fdfs/storage.conf
sed -i "s#\(base_path\).*#\1=/home/data/fastdfs/storage#" /etc/fdfs/storage.conf
sed -i "s#\(store_path0\).*#\1=/home/data/fastdfs/storage#" /etc/fdfs/storage.conf
sed -i "s#\(tracker_server\).*#\1=127.0.0.1:22122#" /etc/fdfs/storage.conf
sed -i "s#\(http.server_port\).*#\1=80#" /etc/fdfs/storage.conf
sed -i "s#\(port\).*#\1=22122#" /etc/fdfs/tracker.conf
sed -i "s#\(base_path\).*#\1=/home/data/fastdfs/tracker#" /etc/fdfs/tracker.conf

sed -i "s#\(base_path\).*#\1=/home/data/fastdfs/storageH#" /etc/fdfs/mod_fastdfs.conf
sed -i "s#\(store_path0\).*#\1=/home/data/fastdfs/storage#" /etc/fdfs/mod_fastdfs.conf
sed -i "s#\(storage_server_port\).*#\1=80#" /etc/fdfs/mod_fastdfs.conf
sed -i "s#\(tracker_server\).*#\1=101.71.21.35:22122#" /etc/fdfs/mod_fastdfs.conf
sed -i "s#\(group_name\).*#\1=group1#" /etc/fdfs/mod_fastdfs.conf
sed -i "s#\(group_count\).*#\1=0#" /etc/fdfs/mod_fastdfs.conf
sed -i "s#\(http.server_port\).*#\1=80#" /etc/fdfs/mod_fastdfs.conf
sed -i "s#\(url_have_group_name\).*#\1=true#" /etc/fdfs/mod_fastdfs.conf

/usr/local/openresty/bin/openresty
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

#临时文件夹要有写权限